<?php
/**
* $Id: appcomponent.php 2942 2009-11-30 10:48:18Z huong.pham $
* Application component base class
*/
class AppComponent{
    protected $CI;
    
    public function __construct(){
        $this->CI = & get_instance();
    }
    
    /**
    * Get configured param value
    * 
    * @param mixed $item
    * @param mixed $default default value if param is not cofigured
    */
    public function config($item, $default = null){
        $value = $this->CI->config->item($item);
        if ($value === false && !is_null($default))
            return $default;
            
        return $value;
    }
    
    
    public function __get($name){
        $method = "get{$name}";
        return $this->$method();
    }
    
    public function __set($name, $value){
        $method = "set{$name}";
        return $this->$method($value);    
    }
}
?>